<?php
//Serve JSON securely
header('Content-Type: text/javascript; charset=utf8');
header('Access-Control-Max-Age: 3628800');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
 
//include_once('lib/includeHub.php');

///The following is done within each function  
     //$json= '('.json_encode($arr).');'; //must wrap in parens and end with semicolon
    //print_r($callback.$json); //callback is prepended for json-p

//To restrict functions, each function must register its name in an array as follows:

//$functions['qlist']='qlist';
//This will make it so that only registered functions can be called
//Core functions:

function qlist() {
    $qlist = new questionPage($_GET['sort'], $_GET['skip'], $_GET['limit']);
    $qlist->displayQuestionList();
}
$functions['qlist'] = 'qlist';


function qview() {
    $qlist=new question($_GET['qid']);
    $qlist->displayQuestion();
}
$functions['qview']='qview';


call_user_func($functions[$_REQUEST['action']]);


?>
